function clickCheckBox(event){
	var target = getTarget(event);
	if($(target).attr('id') == 'present_chk' && $('#point_chk').attr('checked') == 'checked'){
		$('#point_chk').attr('checked', false);
		$('#present_chk').attr('checked', true);
		$('#p_point').val('');
		$('#p_point').parents('.product_wrapper').css('display', 'none');
	}
	else if($(target).attr('id') == 'point_chk' && $('#present_chk').attr('checked') == 'checked'){
		$('#present_chk').attr('checked', false);
		$('#point_chk').attr('checked', true);
		$('#p_point').parents('.product_wrapper').css('display', 'block');
	}
}

function postProduct(){
	var params = new Object();
	
	params.p_name = $('#p_name').val();
	params.p_detail = $('#p_detail').val();
	
	if($('#point_chk').attr('checked') == 'checked'){
		params.regist_type = "포인트";
	}else if($('#present_chk').attr('checked') == 'checked'){
		params.regist_type = "선물";
	}
	if($('#p_point').val() != ''){
		params.p_point = $('#p_point').val();
	}
	
	$.ajax({
		url : "postProduct.action",
		method : "post",
		data : params,
		dataType : "HTML",
		error : function(xhr, textStatus, errorThrown) {
			alert("에러가 발생했어요");
		},
		success : function(data, textStatus) {
			window.location='/main.action';
		}
	});
}


function uploadTmpFile(event){
	var target = getTarget(event);
	var options = {  
	         beforeSubmit:  showRequest,   
	         success:       showResponse,  
	         url: "uploadTmpFile.action",          
	         type: 'POST',
	         ifram: true,
	         contentType: 'multipart/form-data',
	         dataType: 'text',
	         clearForm: true, 
	         resetForm: true
	    }; 
		$(".file_upload_form").ajaxSubmit(options);
		
		function showRequest(formData, jqForm, options) { 
		    var queryString = $.param(formData); 
		     return true; 
		} 
		 
		// post-submit callback 
		function showResponse(responseText, statusText)  {
		    alert(responseText);
		}
}

 
 
// post-submit callback 
function showResponse(responseText, statusText)  {
	alert("test2");
	alert(responseText);
}
